<#include "/common/dialogbox.html">
<@header>
</@header>
<@body>
  	<div class="x_content">
	<form class="form-horizontal form-label-left" method="post" action="${ctx}/system/role/doEdit" id="roleEditForm">
		<input type="hidden" value="${sysRole.id}" name="id">
		<div class="form-group">
			<label class="control-label col-md-2 col-sm-2 col-xs-12">
				角色名称 <span class="required">*</span>
			</label>
			<div class="col-md-9 col-sm-9 col-xs-12">
				<input type="text" id="roleName" name="roleName" value="${(sysRole.roleName)!}" class="form-control" placeholder="请输入角色名" required>
			</div>
		</div>
		<div class="form-group">
			<label class="control-label col-md-2 col-sm-2 col-xs-12">
				角色描述 <span class="required">*</span>
			</label>
			<div class="col-md-9 col-sm-9 col-xs-12">
				<textarea class="form-control" name="roleDesc" rows="3"
					placeholder="请输入描述，最多300个字符 ..." required>${(sysRole.roleDesc)!}</textarea>
			</div>
		</div>
		<div class="form-group">
			<label class="control-label col-md-2 col-sm-2 col-xs-12">
				角色状态 <span class="required">*</span>
			</label>
			<div class="col-md-9 col-sm-9 col-xs-12">
				<label class="radio-box">
					<input name="roleState" type="radio" class="flat" ${(sysRole.roleState==1)?string('checked','')} value="1" required> 启用
				</label>
				<label class="radio-box">
					<input name="roleState" type="radio" class="flat" ${(sysRole.roleState==-1)?string('checked','')}  value="-1" required> 禁用
				</label>
			</div>
		</div>
	</form>
</div>
</@body>
<@footer>
<script type="text/javascript">
	function submitHandler() {
		if ($("#roleEditForm").validate().form()) {
			var formData = $("#roleEditForm").serialize();
			$.ajax({
				url : $("#roleEditForm").attr('action'),
				type : 'POST',
				dataType: "json",
				data : formData,
				success : function(data) {
					if (data.code == 200) {
						if (data.msg) {
							parent.layer.msg(data.msg, {
								icon : 1
							});
						} else {
							parent.layer.msg('提交成功', {
								icon : 1
							});
						}
						window.parent.refreshTable();
						parent.layer.closeAll('iframe');
					} else {
						layer.msg(data.msg, { icon : 2 });
					}
				}
			});
		}
	}
</script>
</@footer>
